package com.szml.common.app.constant;

public enum ShopStatusEnum {
    OFFLINE(0, "下线"),
    ONLINE(1, "上线"),
    DRAFT(2, "草稿"),
    PENDING_APPROVAL(3, "待审批"),
    APPROVED(4, "审批通过"),
    REJECTED(5, "驳回审批");

    private final int code;
    private final String description;

    ShopStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 根据代码获取枚举值
    public static ShopStatusEnum getByCode(int code) {
        for (ShopStatusEnum status : values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid status code: " + code);
    }
}